\(\int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^3} \, dx\) [1196]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F(-2)]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 175 \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^3} \, dx=\frac {\left (a^3 c-3 a b^2 c+3 a^2 b d-b^3 d\right ) x}{\left (a^2+b^2\right )^3}+\frac {\left (3 a^2 b c-b^3 c-a^3 d+3 a b^2 d\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right )^3 f}-\frac {b c-a d}{2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 a b c-a^2 d+b^2 d}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))} \]

[Out]

(a^3*c+3*a^2*b*d-3*a*b^2*c-b^3*d)*x/(a^2+b^2)^3+(-a^3*d+3*a^2*b*c+3*a*b^2*d-b^3*c)*ln(a*cos(f*x+e)+b*sin(f*x+e
))/(a^2+b^2)^3/f+1/2*(a*d-b*c)/(a^2+b^2)/f/(a+b*tan(f*x+e))^2+(a^2*d-2*a*b*c-b^2*d)/(a^2+b^2)^2/f/(a+b*tan(f*x
+e))

Rubi [A] (verified)

Time = 0.32 (sec) , antiderivative size = 175, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3610, 3612, 3611} \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^3} \, dx=-\frac {b c-a d}{2 f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}-\frac {a^2 (-d)+2 a b c+b^2 d}{f \left (a^2+b^2\right )^2 (a+b \tan (e+f x))}+\frac {\left (a^3 (-d)+3 a^2 b c+3 a b^2 d-b^3 c\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right )^3}+\frac {x \left (a^3 c+3 a^2 b d-3 a b^2 c-b^3 d\right )}{\left (a^2+b^2\right )^3} \]

[In]

Int[(c + d*Tan[e + f*x])/(a + b*Tan[e + f*x])^3,x]

[Out]

((a^3*c - 3*a*b^2*c + 3*a^2*b*d - b^3*d)*x)/(a^2 + b^2)^3 + ((3*a^2*b*c - b^3*c - a^3*d + 3*a*b^2*d)*Log[a*Cos
[e + f*x] + b*Sin[e + f*x]])/((a^2 + b^2)^3*f) - (b*c - a*d)/(2*(a^2 + b^2)*f*(a + b*Tan[e + f*x])^2) - (2*a*b
*c - a^2*d + b^2*d)/((a^2 + b^2)^2*f*(a + b*Tan[e + f*x]))

Rule 3610

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b
*c - a*d)*((a + b*Tan[e + f*x])^(m + 1)/(f*(m + 1)*(a^2 + b^2))), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e +
f*x])^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
 - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]

Rule 3611

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c/(b*f))
*Log[RemoveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {b c-a d}{2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}+\frac {\int \frac {a c+b d-(b c-a d) \tan (e+f x)}{(a+b \tan (e+f x))^2} \, dx}{a^2+b^2} \\ & = -\frac {b c-a d}{2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 a b c-a^2 d+b^2 d}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))}+\frac {\int \frac {a^2 c-b^2 c+2 a b d-\left (2 a b c-a^2 d+b^2 d\right ) \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{\left (a^2+b^2\right )^2} \\ & = \frac {\left (a^3 c-3 a b^2 c+3 a^2 b d-b^3 d\right ) x}{\left (a^2+b^2\right )^3}-\frac {b c-a d}{2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 a b c-a^2 d+b^2 d}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))}+\frac {\left (3 a^2 b c-b^3 c-a^3 d+3 a b^2 d\right ) \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{\left (a^2+b^2\right )^3} \\ & = \frac {\left (a^3 c-3 a b^2 c+3 a^2 b d-b^3 d\right ) x}{\left (a^2+b^2\right )^3}+\frac {\left (3 a^2 b c-b^3 c-a^3 d+3 a b^2 d\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right )^3 f}-\frac {b c-a d}{2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 a b c-a^2 d+b^2 d}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 4.74 (sec) , antiderivative size = 243, normalized size of antiderivative = 1.39 \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^3} \, dx=-\frac {d \left (\frac {i \log (i-\tan (e+f x))}{(a+i b)^2}-\frac {i \log (i+\tan (e+f x))}{(a-i b)^2}+\frac {2 b \left (-2 a \log (a+b \tan (e+f x))+\frac {a^2+b^2}{a+b \tan (e+f x)}\right )}{\left (a^2+b^2\right )^2}\right )+(b c-a d) \left (\frac {i \log (i-\tan (e+f x))}{(a+i b)^3}-\frac {\log (i+\tan (e+f x))}{(i a+b)^3}+\frac {b \left (\left (-6 a^2+2 b^2\right ) \log (a+b \tan (e+f x))+\frac {\left (a^2+b^2\right ) \left (5 a^2+b^2+4 a b \tan (e+f x)\right )}{(a+b \tan (e+f x))^2}\right )}{\left (a^2+b^2\right )^3}\right )}{2 b f} \]

[In]

Integrate[(c + d*Tan[e + f*x])/(a + b*Tan[e + f*x])^3,x]

[Out]

-1/2*(d*((I*Log[I - Tan[e + f*x]])/(a + I*b)^2 - (I*Log[I + Tan[e + f*x]])/(a - I*b)^2 + (2*b*(-2*a*Log[a + b*
Tan[e + f*x]] + (a^2 + b^2)/(a + b*Tan[e + f*x])))/(a^2 + b^2)^2) + (b*c - a*d)*((I*Log[I - Tan[e + f*x]])/(a
+ I*b)^3 - Log[I + Tan[e + f*x]]/(I*a + b)^3 + (b*((-6*a^2 + 2*b^2)*Log[a + b*Tan[e + f*x]] + ((a^2 + b^2)*(5*
a^2 + b^2 + 4*a*b*Tan[e + f*x]))/(a + b*Tan[e + f*x])^2))/(a^2 + b^2)^3))/(b*f)

Maple [A] (verified)

Time = 0.38 (sec) , antiderivative size = 206, normalized size of antiderivative = 1.18

method result size
derivativedivides \(\frac {-\frac {\left (a^{3} d -3 a^{2} b c -3 a \,b^{2} d +b^{3} c \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}+\frac {a d -b c}{2 \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )^{2}}+\frac {a^{2} d -2 a b c -b^{2} d}{\left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (f x +e \right )\right )}+\frac {\frac {\left (a^{3} d -3 a^{2} b c -3 a \,b^{2} d +b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c +3 a^{2} b d -3 a \,b^{2} c -b^{3} d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}}{f}\) \(206\)
default \(\frac {-\frac {\left (a^{3} d -3 a^{2} b c -3 a \,b^{2} d +b^{3} c \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}+\frac {a d -b c}{2 \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )^{2}}+\frac {a^{2} d -2 a b c -b^{2} d}{\left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (f x +e \right )\right )}+\frac {\frac {\left (a^{3} d -3 a^{2} b c -3 a \,b^{2} d +b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c +3 a^{2} b d -3 a \,b^{2} c -b^{3} d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}}{f}\) \(206\)
norman \(\frac {\frac {\left (a^{3} c +3 a^{2} b d -3 a \,b^{2} c -b^{3} d \right ) a^{2} x}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}+\frac {b^{2} \left (a^{3} c +3 a^{2} b d -3 a \,b^{2} c -b^{3} d \right ) x \left (\tan ^{2}\left (f x +e \right )\right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}+\frac {2 a^{3} b d -3 a^{2} b^{2} c -b^{4} c}{2 b f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {b \left (-a^{2} b d +2 a \,b^{2} c +b^{3} d \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2 f a \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {2 b \left (a^{3} c +3 a^{2} b d -3 a \,b^{2} c -b^{3} d \right ) a x \tan \left (f x +e \right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}}{\left (a +b \tan \left (f x +e \right )\right )^{2}}+\frac {\left (a^{3} d -3 a^{2} b c -3 a \,b^{2} d +b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {\left (a^{3} d -3 a^{2} b c -3 a \,b^{2} d +b^{3} c \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}\) \(435\)
risch \(\frac {i x d}{3 i a^{2} b -i b^{3}-a^{3}+3 a \,b^{2}}-\frac {x c}{3 i a^{2} b -i b^{3}-a^{3}+3 a \,b^{2}}+\frac {2 i a^{3} d x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}-\frac {6 i a^{2} b c x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}-\frac {6 i a \,b^{2} d x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}+\frac {2 i b^{3} c x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}+\frac {2 i a^{3} d e}{f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {6 i a^{2} b c e}{f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {6 i a \,b^{2} d e}{f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {2 i b^{3} c e}{f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {2 i \left (-i a^{2} b^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}+2 i a \,b^{3} c \,{\mathrm e}^{2 i \left (f x +e \right )}-b^{4} c \,{\mathrm e}^{2 i \left (f x +e \right )}+2 i a^{2} b^{2} d -3 i a \,b^{3} c -b^{3} d a +i b^{4} d \,{\mathrm e}^{2 i \left (f x +e \right )}+2 a^{3} b d \,{\mathrm e}^{2 i \left (f x +e \right )}-3 a^{2} b^{2} c \,{\mathrm e}^{2 i \left (f x +e \right )}-i b^{4} d +2 a^{3} b d -3 a^{2} b^{2} c \right )}{\left (i b +a \right )^{2} \left (-i {\mathrm e}^{2 i \left (f x +e \right )} b +{\mathrm e}^{2 i \left (f x +e \right )} a +i b +a \right )^{2} f \left (-i b +a \right )^{3}}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i b +a}{i b -a}\right ) a^{3} d}{f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i b +a}{i b -a}\right ) a^{2} b c}{f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i b +a}{i b -a}\right ) a \,b^{2} d}{f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i b +a}{i b -a}\right ) b^{3} c}{f \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}\) \(803\)
parallelrisch \(\text {Expression too large to display}\) \(917\)

[In]

int((c+d*tan(f*x+e))/(a+b*tan(f*x+e))^3,x,method=_RETURNVERBOSE)

[Out]

1/f*(-(a^3*d-3*a^2*b*c-3*a*b^2*d+b^3*c)/(a^2+b^2)^3*ln(a+b*tan(f*x+e))+1/2*(a*d-b*c)/(a^2+b^2)/(a+b*tan(f*x+e)
)^2+(a^2*d-2*a*b*c-b^2*d)/(a^2+b^2)^2/(a+b*tan(f*x+e))+1/(a^2+b^2)^3*(1/2*(a^3*d-3*a^2*b*c-3*a*b^2*d+b^3*c)*ln
(1+tan(f*x+e)^2)+(a^3*c+3*a^2*b*d-3*a*b^2*c-b^3*d)*arctan(tan(f*x+e))))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 501 vs. \(2 (173) = 346\).

Time = 0.26 (sec) , antiderivative size = 501, normalized size of antiderivative = 2.86 \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^3} \, dx=\frac {2 \, {\left ({\left (a^{5} - 3 \, a^{3} b^{2}\right )} c + {\left (3 \, a^{4} b - a^{2} b^{3}\right )} d\right )} f x + {\left (2 \, {\left ({\left (a^{3} b^{2} - 3 \, a b^{4}\right )} c + {\left (3 \, a^{2} b^{3} - b^{5}\right )} d\right )} f x + {\left (5 \, a^{2} b^{3} - b^{5}\right )} c - 3 \, {\left (a^{3} b^{2} - a b^{4}\right )} d\right )} \tan \left (f x + e\right )^{2} - {\left (7 \, a^{2} b^{3} + b^{5}\right )} c + {\left (5 \, a^{3} b^{2} - a b^{4}\right )} d + {\left ({\left ({\left (3 \, a^{2} b^{3} - b^{5}\right )} c - {\left (a^{3} b^{2} - 3 \, a b^{4}\right )} d\right )} \tan \left (f x + e\right )^{2} + {\left (3 \, a^{4} b - a^{2} b^{3}\right )} c - {\left (a^{5} - 3 \, a^{3} b^{2}\right )} d + 2 \, {\left ({\left (3 \, a^{3} b^{2} - a b^{4}\right )} c - {\left (a^{4} b - 3 \, a^{2} b^{3}\right )} d\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \, {\left (2 \, {\left ({\left (a^{4} b - 3 \, a^{2} b^{3}\right )} c + {\left (3 \, a^{3} b^{2} - a b^{4}\right )} d\right )} f x + 3 \, {\left (a^{3} b^{2} - a b^{4}\right )} c - {\left (2 \, a^{4} b - 3 \, a^{2} b^{3} + b^{5}\right )} d\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left (a^{6} b^{2} + 3 \, a^{4} b^{4} + 3 \, a^{2} b^{6} + b^{8}\right )} f \tan \left (f x + e\right )^{2} + 2 \, {\left (a^{7} b + 3 \, a^{5} b^{3} + 3 \, a^{3} b^{5} + a b^{7}\right )} f \tan \left (f x + e\right ) + {\left (a^{8} + 3 \, a^{6} b^{2} + 3 \, a^{4} b^{4} + a^{2} b^{6}\right )} f\right )}} \]

[In]

integrate((c+d*tan(f*x+e))/(a+b*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

1/2*(2*((a^5 - 3*a^3*b^2)*c + (3*a^4*b - a^2*b^3)*d)*f*x + (2*((a^3*b^2 - 3*a*b^4)*c + (3*a^2*b^3 - b^5)*d)*f*
x + (5*a^2*b^3 - b^5)*c - 3*(a^3*b^2 - a*b^4)*d)*tan(f*x + e)^2 - (7*a^2*b^3 + b^5)*c + (5*a^3*b^2 - a*b^4)*d
+ (((3*a^2*b^3 - b^5)*c - (a^3*b^2 - 3*a*b^4)*d)*tan(f*x + e)^2 + (3*a^4*b - a^2*b^3)*c - (a^5 - 3*a^3*b^2)*d
+ 2*((3*a^3*b^2 - a*b^4)*c - (a^4*b - 3*a^2*b^3)*d)*tan(f*x + e))*log((b^2*tan(f*x + e)^2 + 2*a*b*tan(f*x + e)
 + a^2)/(tan(f*x + e)^2 + 1)) + 2*(2*((a^4*b - 3*a^2*b^3)*c + (3*a^3*b^2 - a*b^4)*d)*f*x + 3*(a^3*b^2 - a*b^4)
*c - (2*a^4*b - 3*a^2*b^3 + b^5)*d)*tan(f*x + e))/((a^6*b^2 + 3*a^4*b^4 + 3*a^2*b^6 + b^8)*f*tan(f*x + e)^2 +
2*(a^7*b + 3*a^5*b^3 + 3*a^3*b^5 + a*b^7)*f*tan(f*x + e) + (a^8 + 3*a^6*b^2 + 3*a^4*b^4 + a^2*b^6)*f)

Sympy [F(-2)]

Exception generated. \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^3} \, dx=\text {Exception raised: AttributeError} \]

[In]

integrate((c+d*tan(f*x+e))/(a+b*tan(f*x+e))**3,x)

[Out]

Exception raised: AttributeError >> 'NoneType' object has no attribute 'primitive'

Maxima [A] (verification not implemented)

none

Time = 0.40 (sec) , antiderivative size = 333, normalized size of antiderivative = 1.90 \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^3} \, dx=\frac {\frac {2 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c + {\left (3 \, a^{2} b - b^{3}\right )} d\right )} {\left (f x + e\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {2 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c - {\left (a^{3} - 3 \, a b^{2}\right )} d\right )} \log \left (b \tan \left (f x + e\right ) + a\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left ({\left (3 \, a^{2} b - b^{3}\right )} c - {\left (a^{3} - 3 \, a b^{2}\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left (5 \, a^{2} b + b^{3}\right )} c - {\left (3 \, a^{3} - a b^{2}\right )} d + 2 \, {\left (2 \, a b^{2} c - {\left (a^{2} b - b^{3}\right )} d\right )} \tan \left (f x + e\right )}{a^{6} + 2 \, a^{4} b^{2} + a^{2} b^{4} + {\left (a^{4} b^{2} + 2 \, a^{2} b^{4} + b^{6}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (a^{5} b + 2 \, a^{3} b^{3} + a b^{5}\right )} \tan \left (f x + e\right )}}{2 \, f} \]

[In]

integrate((c+d*tan(f*x+e))/(a+b*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

1/2*(2*((a^3 - 3*a*b^2)*c + (3*a^2*b - b^3)*d)*(f*x + e)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) + 2*((3*a^2*b - b
^3)*c - (a^3 - 3*a*b^2)*d)*log(b*tan(f*x + e) + a)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) - ((3*a^2*b - b^3)*c -
(a^3 - 3*a*b^2)*d)*log(tan(f*x + e)^2 + 1)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) - ((5*a^2*b + b^3)*c - (3*a^3 -
 a*b^2)*d + 2*(2*a*b^2*c - (a^2*b - b^3)*d)*tan(f*x + e))/(a^6 + 2*a^4*b^2 + a^2*b^4 + (a^4*b^2 + 2*a^2*b^4 +
b^6)*tan(f*x + e)^2 + 2*(a^5*b + 2*a^3*b^3 + a*b^5)*tan(f*x + e)))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 413 vs. \(2 (173) = 346\).

Time = 0.53 (sec) , antiderivative size = 413, normalized size of antiderivative = 2.36 \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^3} \, dx=\frac {\frac {2 \, {\left (a^{3} c - 3 \, a b^{2} c + 3 \, a^{2} b d - b^{3} d\right )} {\left (f x + e\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left (3 \, a^{2} b c - b^{3} c - a^{3} d + 3 \, a b^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {2 \, {\left (3 \, a^{2} b^{2} c - b^{4} c - a^{3} b d + 3 \, a b^{3} d\right )} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}} - \frac {9 \, a^{2} b^{3} c \tan \left (f x + e\right )^{2} - 3 \, b^{5} c \tan \left (f x + e\right )^{2} - 3 \, a^{3} b^{2} d \tan \left (f x + e\right )^{2} + 9 \, a b^{4} d \tan \left (f x + e\right )^{2} + 22 \, a^{3} b^{2} c \tan \left (f x + e\right ) - 2 \, a b^{4} c \tan \left (f x + e\right ) - 8 \, a^{4} b d \tan \left (f x + e\right ) + 18 \, a^{2} b^{3} d \tan \left (f x + e\right ) + 2 \, b^{5} d \tan \left (f x + e\right ) + 14 \, a^{4} b c + 3 \, a^{2} b^{3} c + b^{5} c - 6 \, a^{5} d + 7 \, a^{3} b^{2} d + a b^{4} d}{{\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )} {\left (b \tan \left (f x + e\right ) + a\right )}^{2}}}{2 \, f} \]

[In]

integrate((c+d*tan(f*x+e))/(a+b*tan(f*x+e))^3,x, algorithm="giac")

[Out]

1/2*(2*(a^3*c - 3*a*b^2*c + 3*a^2*b*d - b^3*d)*(f*x + e)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) - (3*a^2*b*c - b^
3*c - a^3*d + 3*a*b^2*d)*log(tan(f*x + e)^2 + 1)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) + 2*(3*a^2*b^2*c - b^4*c
- a^3*b*d + 3*a*b^3*d)*log(abs(b*tan(f*x + e) + a))/(a^6*b + 3*a^4*b^3 + 3*a^2*b^5 + b^7) - (9*a^2*b^3*c*tan(f
*x + e)^2 - 3*b^5*c*tan(f*x + e)^2 - 3*a^3*b^2*d*tan(f*x + e)^2 + 9*a*b^4*d*tan(f*x + e)^2 + 22*a^3*b^2*c*tan(
f*x + e) - 2*a*b^4*c*tan(f*x + e) - 8*a^4*b*d*tan(f*x + e) + 18*a^2*b^3*d*tan(f*x + e) + 2*b^5*d*tan(f*x + e)
+ 14*a^4*b*c + 3*a^2*b^3*c + b^5*c - 6*a^5*d + 7*a^3*b^2*d + a*b^4*d)/((a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6)*(b*
tan(f*x + e) + a)^2))/f

Mupad [B] (verification not implemented)

Time = 6.67 (sec) , antiderivative size = 279, normalized size of antiderivative = 1.59 \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^3} \, dx=-\frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (\frac {a\,d-3\,b\,c}{{\left (a^2+b^2\right )}^2}-\frac {4\,b^2\,\left (a\,d-b\,c\right )}{{\left (a^2+b^2\right )}^3}\right )}{f}-\frac {\frac {-3\,d\,a^3+5\,c\,a^2\,b+d\,a\,b^2+c\,b^3}{2\,\left (a^4+2\,a^2\,b^2+b^4\right )}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (-d\,a^2\,b+2\,c\,a\,b^2+d\,b^3\right )}{a^4+2\,a^2\,b^2+b^4}}{f\,\left (a^2+2\,a\,b\,\mathrm {tan}\left (e+f\,x\right )+b^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (-d+c\,1{}\mathrm {i}\right )}{2\,f\,\left (-a^3-a^2\,b\,3{}\mathrm {i}+3\,a\,b^2+b^3\,1{}\mathrm {i}\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (c-d\,1{}\mathrm {i}\right )}{2\,f\,\left (-a^3\,1{}\mathrm {i}-3\,a^2\,b+a\,b^2\,3{}\mathrm {i}+b^3\right )} \]

[In]

int((c + d*tan(e + f*x))/(a + b*tan(e + f*x))^3,x)

[Out]

(log(tan(e + f*x) - 1i)*(c*1i - d))/(2*f*(3*a*b^2 - a^2*b*3i - a^3 + b^3*1i)) - ((b^3*c - 3*a^3*d + 5*a^2*b*c
+ a*b^2*d)/(2*(a^4 + b^4 + 2*a^2*b^2)) + (tan(e + f*x)*(b^3*d + 2*a*b^2*c - a^2*b*d))/(a^4 + b^4 + 2*a^2*b^2))
/(f*(a^2 + b^2*tan(e + f*x)^2 + 2*a*b*tan(e + f*x))) - (log(a + b*tan(e + f*x))*((a*d - 3*b*c)/(a^2 + b^2)^2 -
 (4*b^2*(a*d - b*c))/(a^2 + b^2)^3))/f + (log(tan(e + f*x) + 1i)*(c - d*1i))/(2*f*(a*b^2*3i - 3*a^2*b - a^3*1i
 + b^3))